-
-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Concept: Pipelines and Command Lists #714
base: main
Are you sure you want to change the base?
Conversation
``` | ||
|
||
The pipe symbol (`|`) connects the output of one command to the input of another. | ||
`cut` reads the output of `cat`, and `sort` reads the output of `cut`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to take a step back and mention how many commands read from STDIN (and/or a file) and write to STDOUT? Introduce STDIN/STDOUT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I'll do a "sneak preview" of I/O, with a promise of more to come in a later concept.
Co-authored-by: Isaac Good <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though draft, still looks good to me.
806ff1d
to
253f794
Compare
@IsaacG can I get your opinion on the I/O blurb please? |
concepts/pipelines/about.md
Outdated
* A process can emit _error output_ on "stderr". | ||
|
||
The `tr` command is a very pure example of this. | ||
All it does is read text from its stdin, perform character transliterations, and print the resulting text to stdout. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We quote stdout in prior references, should we keep it consistent. It is a literal in the language as well. If we are generally talking about standard out and standard in, then expressing it in that way may be useful. Similar to standard input/output or I/O or something other than stdio as plain text, rather than somehow marked as the "thing" we are referencing in terms of the language, rather than an idea. Consistency is really what my comment is about, not only this line and close to this line, but throughout this document, at least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggested changes, but still approved.
concepts/pipelines/about.md
Outdated
|
||
### Uses of Command Lists | ||
|
||
Here are a couple of examples where command lists can simplify bash code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are a couple of examples where command lists can simplify bash code. | |
Here are a couple of examples where command lists can simplify the code. |
Because the context is Bash, we can likely reference it this way.
concepts/pipelines/about.md
Outdated
|
||
#### Reading blocks of lines from a file | ||
|
||
Suppose you have a data file that represents points of a triangle as the length of the three sides but each on a separate line. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suppose you have a data file that represents points of a triangle as the length of the three sides but each on a separate line. | |
Suppose you have a data file that represents the sides of a triangle as the length of the three sides but each on a separate line. |
It still seems a bit clunky or something with the change, but points never have a length, so we must be talking about something with a length, and that would be the sides.
concepts/pipelines/about.md
Outdated
assert(x == 5, "x must be 5"); | ||
``` | ||
|
||
We can use an OR operator in bash to simulate that function: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use an OR operator in bash to simulate that function: | |
We can use an OR operator in Bbash to simulate that function: |
I believe Bash as a name of the scripting language should be capitalized, otherwise it appears as though we are talking about the executable, rather than the language.
concepts/pipelines/introduction.md
Outdated
|
||
## I/O | ||
|
||
Before we start, a quick intro to input/output. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before we start, a quick intro to input/output. | |
Before we start, a quick introduction to input/output, pretty commonly referenced as "I/O". |
concepts/pipelines/introduction.md
Outdated
* By default, each command in a pipeline runs in a separate subshell. | ||
(A subshell is a child process that is a copy of the currently running shell.) | ||
|
||
* All the commands in a subshell execute in parallel. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this always the case? Should we state that Bash is designed so that if it can, subshells are executed in parallel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, all the commands in a pipeline execute in parallel.
I can't find where in the manual this is stated, although I believe it to be true. I can just remove it.
concepts/pipelines/introduction.md
Outdated
|
||
#### Reading blocks of lines from a file | ||
|
||
Suppose you have a data file that represents points of a triangle as the length of the three sides but each on a separate line. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As in the other file, I believe points by definition have no length, nor size.
No description provided.